#include "rectangle.h"

namespace vgl{

Rectangle::Rectangle(int x,int y,int w,int h):Shape(shape_rectangle){

	m_transform.Translate(x,y);
	m_transform.Scale(w,h);


	add_control_point(x,y);
	add_control_point(x+w,y);
	add_control_point(x+w,y+h);
	add_control_point(x,y+h);

	add_control_point(x+w/2,y);
	add_control_point(x+w,y+h/2);
	add_control_point(x+w/2,y+h);
	add_control_point(x,y+h/2);

};


void Rectangle::draw(graphics_t &g){
	
	pen_t pen(color_t(255,0,0,0));

	g.DrawLine(&pen,m_ctrl_pts[0],m_ctrl_pts[1]);
	g.DrawLine(&pen,m_ctrl_pts[1],m_ctrl_pts[2]);
	g.DrawLine(&pen,m_ctrl_pts[2],m_ctrl_pts[3]);
	g.DrawLine(&pen,m_ctrl_pts[3],m_ctrl_pts[0]);


	Shape::draw(g);
};

};